import tornado.ioloop
import tornado.web

import settings
from util import get_logger
from handlers import get_routings

log = get_logger(__name__)

application = tornado.web.Application(
    get_routings(),
    static_path=settings.static_path,
    debug=settings.debug,
    cookie_secret=settings.cookie_secret,
)

if __name__ == "__main__":
    log.info('Listening at port %s' % settings.port)
    application.listen(settings.port)
    tornado.ioloop.IOLoop.instance().start()
